<template>
  <div id="nav">
    <router-link to="/">主Home</router-link> |
    <router-link to="/about">About</router-link>
  </div>
  <div class="about">
    <h1>This is an about page</h1>
    <button @click="handleClick">admin</button>
  </div>
</template>

<script>
import { useRouter } from 'vue-router'
import { defineComponent } from 'vue'

export default defineComponent({
  setup() {
    const router = useRouter()

    const handleClick = () => {
      router.push('/admin')
    }

    return {
      handleClick,
    }
  }
})
</script>

<style lang="less" scoped>

  #nav {
    padding: 30px;
  
    a {
      font-weight: bold;
      color: #2c3e50;
  
      &.router-link-exact-active {
        color: #42b983;
      }
    }
  }
.about {
  button {
    width: 100px;
    height: 40px;
    border-radius: 4px;
    cursor: pointer;
  }
}
</style>